
<?
	 layout("/inc/win_layout.html",{title:sysTitle}){
    ?>

<div class="row">
	<div class="col-lg-12">
		<div class="panel panel">
			<div class="panel-body pan" style="height: 425px">
				<div class="form-body pal" >
					<ul id="tree" class="ztree" style="width:270px"; overflow:auto;"></ul>
	                <div id="dataNull" class="panel-body" style="height: 90px; line-height: 50px;" align="center"></div>
				</div>
			</div>
		</div>
	</div>
</div>
<?}?>
<script>
$(function() {
	initTree() 
	});
function initTree() {
		$.ajax({
			type : "post",
			url : "./KnowledgeclassListall.do",
			dataType : "json",
			beforeSend : function(XMLHttpRequest) {
			},
			success : drawTree,
		});
	}

	function drawTree(data) {
		var setting = {
			check: {
				enable: true,
				nocheckInherit: true,
				chkboxType: {"Y" : " ", "N" : " "}
			},
			view: {
				dblClickExpand: false
			},
			data: {
				simpleData: {
					enable: true
				}
			},
			callback : {
				onClick : onClick
			},
		};
		var zNodes = eval(data);
			if(data.length>0){
					$("#dataNull").hide();
				}else{
					$("#dataNull").html("<span class='subtitle' style=\"font-size: 15px;\">数据为空!</span>");
				}	
		$.fn.zTree.init($("#tree"), setting, zNodes).expandAll(true);
		zTree = $.fn.zTree.getZTreeObj("tree");
		zTree.expandNode(zTree.getNodes()[0], true);//指定某节点折叠
	}
	function onClick(e, treeId, treeNode) {
	//alert(treeNode.id);
	//alert(treeNode.name);
		classid = treeNode.id;
		classname = treeNode.name;
		if(typeof treeNode.children == 'undefined'){
			
		}else{
			
		}
		if(treeNode.children==null){
      
        }else{
       
        }
       
	}
	//知识结构管理导出
	function start(){
	var treeObj = $.fn.zTree.getZTreeObj("tree");
			var checkedNode = treeObj.getCheckedNodes(); 
			var menuids="";
			for(var i=0;i<checkedNode.length;i++){
				if(checkedNode[i].id!=null){
					menuids+=checkedNode[i].id+",";
				}
			}
			//alert(menuids);
		if (confirm("是否确认导出！")){
			var _downiframe = $("iframe#_downiframe");
			if (_downiframe.length == 0) {
				_downiframe =$("<iframe id='_downiframe' name='_downiframe' style='display:none'></iframe>").appendTo($("body"));
			}
			_downiframe.attr("src", "classExportdownload.do?menuids="+menuids);
			
			/* $.ajax({
				type : "post",
				url : "./classExportdownload.do",
				 data : {
					"menuids" : menuids
				}, 
				dataType : "json",
				success : function(data) {
				var index = parent.layer.getFrameIndex(window.name);
				window.parent.exportclass();
				parent.layer.msg('提交成功');
				parent.layer.close(index);	
				},
				error : function(data) {
					alert("请求失败");
				}
			}); */
		}
	}
</script>